package com.bw.liuyushan.zhuangao4_weektest2.DaoSQL;

import android.database.sqlite.SQLiteDatabase;

import com.bw.liuyushan.zhuangao4_weektest2.App.App;

/**
 * ZhuanGao4_WeekTest2
 * file name is : UserMsgUtils
 * created by Ender on 2021/8/25 14:52.
 * author : 刘雨杉
 * Describe(作用):
 */
public class UserMsgUtils {
    private static UserMsgUtils userMsgUtils;

    public static UserMsgUtils getInstance() {
        if (userMsgUtils==null){
            userMsgUtils=new UserMsgUtils();
        }
        return userMsgUtils;
    }
    private static DaoSession daoSession;

    private UserMsgUtils() {
        DaoMaster.DevOpenHelper devOpenHelper = new DaoMaster.DevOpenHelper(App.context, "UserMag.db");
        SQLiteDatabase writableDatabase = devOpenHelper.getWritableDatabase();
        DaoMaster daoMaster = new DaoMaster(writableDatabase);
        daoSession=daoMaster.newSession();
    }

    public UserMsgDao getDaoSession() {
        return daoSession.getUserMsgDao();
    }
}
